import {Notification} from "element-ui";

export const successMessage=(message)=>{
    window.MyVue.$notify({
        message,
        type: 'success'
    })
}

export const warningMessage=(message)=>{
    window.MyVue.$notify({
        message,
        type: 'warning'
    })
}

export const debounceMessage = debounce(Notification,500);
function debounce(func, wait) {
    let timeout;
    return function () {
        const context = this;
        const args = [...arguments];
        if (timeout) clearTimeout(timeout);
        timeout = setTimeout(() => {
            func.apply(context, args)
        }, wait);
    }
}